package com.xq.shop.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xq.shop.dao.IProductScoreDAO;
import com.xq.shop.po.ProductScore;
import com.xq.shop.util.HibernateUtil;

@Repository
public class ProductScoreDAO extends BaseDAO<ProductScore> implements IProductScoreDAO {

	@SuppressWarnings("unchecked")
	@Override
	public ProductScore get(Long userId, Long orderId, Long productId) {
		
		String hql = " from ProductScore where user_id=? and order_id=? and product_id=?";
		List<ProductScore> list = HibernateUtil.getTemplate().find(hql, new Object[]{userId, orderId, productId});
		if(list != null && list.size() > 0){
			return list.get(0);
		} else {
			return null;
		}
	}
}
